
#include "Vector2.h"
#include "Vector3.h"

namespace soft_renderer
{
	Vector2::Vector2(double x, double y)
	{
		data[0] = x;
		data[1] = y;
	}

	void Vector2::set(double x, double y)
	{
		data[0] = x;
		data[1] = y;
	}

	void Vector2::setX(double x)
	{
		data[0] = x;
	}

	void Vector2::setY(double y)
	{
		data[1] = y;
	}

	void Vector2::copy(const Vector2& v)
	{
		data[0] = v.data[0];
		data[1] = v.data[1];
	}

	void Vector2::copy(const Vector3& v)
	{
		data[0] = v.data[0];
		data[1] = v.data[1];
	}

	double Vector2::x()
	{
		return data[0];
	}

	double Vector2::y()
	{
		return data[1];
	}

	double Vector2::cross(const Vector2& v)
	{
		return data[0] * v.data[1] - data[1] * v.data[0];
	}
}

